<?php
ini_set('opcache.revalidate_freq', 0);
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$today = getBingToday();
$url = $today['url'] ? $today['url'] : $today['urlstr'];
?>
<!DOCTYPE HTML>
<html lang="zh-cn">

    <head><?php $this->need('header.php'); ?></head>

    <body class="bg-tran">
        <div class="container" style="padding:15px;">
            <div class="columns px-0">
                <div class="column col-12 cont" style="margin-bottom:10px;">
                    <?php $this->content(); ?>
                </div>
            </div>
        </div>
        <script>
        (() => {
            const parent = window.parent.length
            if (parent === 0) location.href = '/'

            window.theme = getSystemTheme()
            document.body.setAttribute('data-theme', getSystemTheme());
            window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {
                const newTheme = event.matches ? 'dark' : 'light';
                document.body.setAttribute('data-theme', newTheme);
            });
        })()

        function getSystemTheme() {
            if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
                return 'dark';
            } else {
                return 'light';
            }
        }
        </script>
    </body>

</html>